function genRoutes(geojson, filepath) { const routeIds = []; const routeNames = []; let routesTxt = "route_id,route_short_name,route_long_name,route_color,route_text_color,route_type"; geojson.features.forEach(f => { const p = f.properties; const names = p.route_short_name.split(","); const id = p.route_id; names.forEach(n => { if (!routeNames.includes(n)) { routesTxt += ["\n"+ id,id,n,p.route_color,p.route_text_color,"3"].join(","); routeNames.push(n); routeIds.push(id) } }) }); fs.writeFileSync(filepath, routesTxt, "utf-8") }